import request from '@/utils/request'

// 查询订单维护列表
export function listPurchaseOrder(query) {
    return request({
        url: '/purchaseOrder/list',
        method: 'get',
        params: query
    })
}

// 查询订单变更列表
export function listChangePurchaseOrder(query) {
    return request({
        url: '/purchaseOrder/change/list',
        method: 'get',
        params: query
    })
}

//查询采购执行订单列表
export function listPurchaseExecutionOrder(query) {
    return request({
        url: '/purchaseOrder/execution/list',
        method: 'get',
        params: query
    })
}

// 查询订单维护详细
export function getPurchaseOrder(orderNo) {
    return request({
        url: '/purchaseOrder/' + orderNo,
        method: 'get'
    })
}

// 新增订单
export function addPurchaseOrder(data) {
    return request({
        url: '/purchaseOrder',
        method: 'post',
        data: data
    })
}

// 变更订单
export function changePurchaseOrder(data) {
    return request({
        url: '/purchaseOrder/operator',
        method: 'put',
        data: data
    })
}

// 变更订单
export function changePurchaseOrderByProvider(data) {
    return request({
        url: '/purchaseOrder/provider',
        method: 'put',
        data: data
    })
}

// 变更订单
export function updatePurchaseOrder(data) {
    return request({
        url: '/purchaseOrder/edit',
        method: 'put',
        data: data
    })
}

// 删除订单维护
export function delPurchaseOrder(orderNo) {
    return request({
        url: '/purchaseOrder/' + orderNo,
        method: 'delete'
    })
}

//退货
export function returnPurchaseOrder(orderNo) {
    return request({
        url: '/purchaseOrder/return',
        method: 'post',
        data: orderNo
    })
}

//更新订单状态
export function updatePurchaseOrderStatus(data) {
    return request({
        url: '/purchaseOrder/update/status',
        method: 'post',
        data: data
    })
}